package com.ymttest.database.sqlwapper.shenqisettlement;

import java.util.HashMap;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqisettlement.ProxyFissionProductDetail;

public class ProxyFissionProductDetailWrapper {

	SqlManager manager;

	public ProxyFissionProductDetailWrapper() {
		manager = new SqlManager("shenqisettlement");
	}

	@SuppressWarnings("unchecked")
	public ProxyFissionProductDetail selectByPrimaryKey(long id) {

		ProxyFissionProductDetail proxyFissionProductDetail = new ProxyFissionProductDetail();
		List<ProxyFissionProductDetail> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqisettlement.ProxyFissionProductDetailMapper.selectByPrimaryKey",
						id);
		manager.commit();

		if (result.size() > 0) {
			proxyFissionProductDetail = result.get(0);
		}

		return proxyFissionProductDetail;
	}
	
	@SuppressWarnings("unchecked")
	public ProxyFissionProductDetail selectByOrderIdAndProxyIdAndCatalogId(Long orderId, Long proxyId, String catalogId) {

		HashMap<String, Object> map = new HashMap<>();
		
		map.put("order_id", orderId);
		map.put("proxy_id", proxyId);
		map.put("catalog_id", catalogId);
		
		ProxyFissionProductDetail proxyFissionProductDetail = new ProxyFissionProductDetail();
		List<ProxyFissionProductDetail> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqisettlement.ProxyFissionProductDetailMapper.selectByOrderIdAndProxyIdAndCatalogId",
						map);
		manager.commit();

		if (result.size() > 0) {
			proxyFissionProductDetail = result.get(0);
		}

		return proxyFissionProductDetail;
	}
	
	public static void main(String[] args) {
		
		ProxyFissionProductDetailWrapper wrapper = new ProxyFissionProductDetailWrapper();
		
		System.out.println(wrapper.selectByPrimaryKey(1));
	}
}
